#include "DynCreateCls.h"

#include<iostream>
#include<vector>
#include"Shape.h"
#include "DynBase.h"

using namespace std;

void DrawAllShapes(const vector<Shape*>* v) {
	vector<Shape*>::const_iterator it;
	for (it = v->begin(); it != v->end(); it++) {
		(*it)->Draw();
	}
}

void DeleteAllShapes(const vector<Shape*>* v) {
	vector<Shape*>::const_iterator it;
	for (it = v->begin(); it != v->end(); it++) {
		delete(*it);
	}
}

int main()
{
	vector<Shape*> vector;
	Shape* shape;
	shape = static_cast<Shape*>(DynObjectFactory::CreateObject("Circle"));
	vector.push_back(shape);

	shape = static_cast<Shape*>(DynObjectFactory::CreateObject("Rectangle"));
	vector.push_back(shape);

	shape = static_cast<Shape*>(DynObjectFactory::CreateObject("Square"));
	vector.push_back(shape);

	DrawAllShapes(&vector);

	DeleteAllShapes(&vector);

	return 0;
}